php forum
php mysql forum
php mysql smarty
 
Topic Options
#312654 - 01/12/07 09:23 PM [7.0.x] Forum Stats: Posts in the last 24 hours.
gliderdad79 Offline
User

Registered: 03/24/06
Posts: 31
This is a small mod to add to your forum stats on how many posts were made in 24 hours.

In cache builders ->forum_stats.php

Add:
Code:
// Get last Total Posts for Last 24hrs 
// get the current timestamp into an array
$timestamp = time();
// echo strftime('%Hh%M %A %d %b',$timestamp);
// echo '<p>';
$date_time_array = getdate($timestamp);

$hours = $date_time_array['hours'];
$minutes = $date_time_array['minutes'];
$seconds = $date_time_array['seconds'];
$month = $date_time_array['mon'];
$day = $date_time_array['mday'];
$year = $date_time_array['year'];

// use mktime to recreate the unix timestamp
// adding 19 hours to $hours
$timestamp = mktime($hours - 29,$minutes,$seconds,$month,$day,$year);
// echo strftime('%Hh%M %A %d %b',$timestamp);
// echo '<br>~E after subtracting 29 hours';

$query = "
select count(*)
from {$config['TABLE_PREFIX']}POSTS
WHERE POST_POSTED_TIME > $timestamp
";
$sth = $dbh->do_query($query);
list($new_posts) = $dbh->fetch_array($sth);


Under:
Code:
$query = "
select count(USER_ID)
from {$config['TABLE_PREFIX']}USERS
where USER_IS_APPROVED = 'yes'
and USER_ID > 1
";
$sth = $dbh->do_query($query);
list($users) = $dbh->fetch_array($sth);


In langauges->island_forum_stats.php

Add:
Code:
$ubbt_lang['NEW_POSTS'] = "Posts in 24rs";

Under:
Code:
$ubbt_lang['USERS'] = "Members";


In templates->island_forum_stats.tpl

Add:
Code:
<b>{$new_posts}</b> {$lang.NEW_POSTS}


Above:
Code:
<b>{$users}</b> {$lang.USERS}


Quoting Ian from a post at ubbthreads
Originally Posted By: Ian
In langauges->island_forum_stats.php

is langauges->portal_islands.php

in 7.1 beta (when you get it)


Screen shot of what it adds

Top
#312656 - 01/12/07 10:04 PM Re: Forum Stats [Re: gliderdad79]
Ian Spence Offline
Master Hacker

Registered: 01/25/03
Posts: 3765
Loc: Saint Johns, PA
Code:
// Get last Total Posts for Last 24hrs 
// get the current timestamp into an array
$timestamp = time();
// echo strftime('%Hh%M %A %d %b',$timestamp);
// echo '<p>';
$date_time_array = getdate($timestamp);

$hours = $date_time_array['hours'];
$minutes = $date_time_array['minutes'];
$seconds = $date_time_array['seconds'];
$month = $date_time_array['mon'];
$day = $date_time_array['mday'];
$year = $date_time_array['year'];

// use mktime to recreate the unix timestamp
// adding 19 hours to $hours
$timestamp = mktime($hours - 29,$minutes,$seconds,$month,$day,$year);
// echo strftime('%Hh%M %A %d %b',$timestamp);
// echo '<br>~E after subtracting 29 hours';


could be simplied to

Code:
$timestamp = time() - 86400;

Top
#312657 - 01/12/07 11:23 PM Re: Forum Stats [Re: Ian Spence]
Gizmo Offline

Wizard

Registered: 01/10/00
Posts: 5354
Loc: Portland, OR, USA
I posted something similar (well about being able to do this) at ubbcentral wink
_________________________
UBB.Dev - Where you too can render your UBB install completely useless...
UGN Security, Elite Web Gamers & VNC Web Design & Development President
UBB.Threads: My UBBSkins, UBB.Sitemaps

Top
#312663 - 01/13/07 11:47 AM Re: Forum Stats [Re: Gizmo]
gliderdad79 Offline
User

Registered: 03/24/06
Posts: 31
Scratch this, not gona work for 7.1

Top
#312666 - 01/14/07 03:47 AM Re: Forum Stats [Re: gliderdad79]
Gizmo Offline

Wizard

Registered: 01/10/00
Posts: 5354
Loc: Portland, OR, USA
A 7.1 version can be found here
_________________________
UBB.Dev - Where you too can render your UBB install completely useless...
UGN Security, Elite Web Gamers & VNC Web Design & Development President
UBB.Threads: My UBBSkins, UBB.Sitemaps

Top



Moderator:  sirdude 
Latest Posts
[7.2.1] - Naked shoutbox
by bellaonline
05/05/12 05:00 PM
[7.x] Stop Forum Spam Integration v0.4
by bellaonline
05/05/12 03:53 PM
Shout Box

(Views)Popular Topics
Known public proxy servers 1689885
Integrated Index Page (IIP) 5.3.1 555705
Finished-[6.5.2] Games Arcade Deluxe v1.9 501236
Integrated Index Page (IIP) 5.1.1 415112
TLD Bv2.1 Released - Threads Links Directory 396822
[6.0x] Who's Online 4.0.0 [Finished] 389412
Finished-[6.5.1] Integrated Index Page (IIP) 6.5 330423
Q & A 298663
Slash UBB 266936
[6.3.x] [beta] Hit Hack 2.0 227970
Forum Stats
13621 Members
59 Forums
37191 Topics
295716 Posts

Max Online: 686 @ 06/28/07 07:04 AM

 

 

 
fusionbb message board php hacks